dmlfw (Daniyal Machine Learning Framework)
example_dmlfw_utils_file.c

Typical usage:

#include <stdio.h>
#include <dmlfw_utils.h>
#include <dmlfw_error.h>
int main(void) {
char err[512], dbg[512];
const char *filename = "data.csv";
uint64_t rows = dmlfw_get_csv_rows_count(filename);
if (dmlfw_error()) {
dmlfw_get_error_string(err, sizeof(err));
dmlfw_get_debug_string(dbg, sizeof(dbg));
printf("Error counting rows: %s\nDebug info: %s\n", err, dbg);
return 1;
}
uint64_t cols = dmlfw_get_csv_columns_count(filename);
if (dmlfw_error()) {
dmlfw_get_error_string(err, sizeof(err));
dmlfw_get_debug_string(dbg, sizeof(dbg));
printf("Error counting columns: %s\nDebug info: %s\n", err, dbg);
return 1;
}
printf("CSV '%s' has %llu rows and %llu columns\n", filename, rows, cols);
uint64_t rows2, cols2;
dmlfw_get_csv_dimensions(filename, &rows2, &cols2);
if (dmlfw_error()) {
dmlfw_get_error_string(err, sizeof(err));
dmlfw_get_debug_string(dbg, sizeof(dbg));
printf("Error getting dimensions: %s\nDebug info: %s\n", err, dbg);
return 1;
}
printf("Dimensions verified: %llu rows, %llu columns\n", rows2, cols2);
return 0;
}
int main()
Main function to execute batch gradient descent linear regression example.
Definition batch_gd.c:316
Centralized error handling interface for the framework.
void dmlfw_get_error_string(char *error_string, uint32_t size)
Copies the last error message into the provided character buffer.
uint8_t dmlfw_error(void)
Checks if the last framework call resulted in an error.
void dmlfw_get_debug_string(char *debug_string, uint32_t size)
Copies detailed debug information about the last error into the provided character buffer.
Core utility functions for file and string processing.
uint64_t dmlfw_get_csv_rows_count(const char *csv_file_name)
Counts the number of rows in a CSV file.
uint64_t dmlfw_get_csv_columns_count(const char *csv_file_name)
Counts the number of columns in a CSV file.
void dmlfw_get_csv_dimensions(const char *csv_file_name, uint64_t *rows, uint64_t *columns)
Retrieves both the row and column counts of a CSV file.